package org.deyang.tools.amazon.pojos;

public class PriceInformation {
	
	private String amazonPrice = "";
	private String amazonPriceAmount = "-1";
	private String thirdPartyPrice = "";
	private String thirdPartyPriceAmount = "-1";
	private boolean isAmazonPriceAvailable = false;
	private boolean isThirdPartyPriceAvailable = false;
	
	public String getSavedPercentage(String listPriceAmount){
		if (listPriceAmount == null || listPriceAmount.equals("")){
			return "";
		}else{
			if (this.isAmazonPriceAvailable){
				long value = Math.round((1 - Double.parseDouble(this.amazonPriceAmount) / Double.parseDouble(listPriceAmount)) * 100);
				if (value != 0){
					return "Save " + value + "%! ";
				}else{
					return "";
				}
			}else if(this.isThirdPartyPriceAvailable){
				long value = Math.round((1 - Double.parseDouble(this.thirdPartyPriceAmount) / Double.parseDouble(listPriceAmount)) * 100);
				if (value != 0){
					return "Save " + value + "%! ";
				}else{
					return "";
				}
			}else{
				return "";
			}
		}
	}
	
	public String getAmazonPrice() {
		return amazonPrice;
	}
	public String getAvailablePrice(){
		if (this.isAmazonPriceAvailable){
			return this.amazonPrice;
		}else if(this.isThirdPartyPriceAvailable){
			return this.thirdPartyPrice;
		}else{
			return "No available price";
		}
	}
	public void setAmazonPrice(String amazonPrice) {
		this.amazonPrice = amazonPrice;
	}
	public String getAmazonPriceAmount() {
		return amazonPriceAmount;
	}
	public void setAmazonPriceAmount(String amazonPriceAmount) {
		this.amazonPriceAmount = amazonPriceAmount;
	}
	public String getThirdPartyPrice() {
		return thirdPartyPrice;
	}
	public void setThirdPartyPrice(String thirdPartyPrice) {
		this.thirdPartyPrice = thirdPartyPrice;
	}
	public String getThirdPartyPriceAmount() {
		return thirdPartyPriceAmount;
	}
	public void setThirdPartyPriceAmount(String thirdPartyPriceAmount) {
		this.thirdPartyPriceAmount = thirdPartyPriceAmount;
	}
	public boolean isAmazonPriceAvailable() {
		return isAmazonPriceAvailable;
	}
	public void setAmazonPriceAvailable(boolean isAmazonPriceAvailable) {
		this.isAmazonPriceAvailable = isAmazonPriceAvailable;
	}
	public boolean isThirdPartyPriceAvailable() {
		return isThirdPartyPriceAvailable;
	}
	public void setThirdPartyPriceAvailable(boolean isThirdPartyPriceAvailable) {
		this.isThirdPartyPriceAvailable = isThirdPartyPriceAvailable;
	}
	


}
